package com.tai.design.combination;

/**
 * The type Menu component.
 *
 * @version v1.0
 * @ClassName: MenuComponent
 * @Description: 菜单组件 ： 属于抽象根节点
 * @Author: taylor
 */
public abstract class MenuComponent {
    /**
     * The Name.
     */
//菜单组件的名称
    protected String name;
    /**
     * The Level.
     */
//菜单组件的层级
    protected int level;

    /**
     * Add.
     *
     * @param menuComponent the menu component
     */
//添加子菜单
    public void add(MenuComponent menuComponent) {
        throw new UnsupportedOperationException();
    }

    /**
     * Remove.
     *
     * @param menuComponent the menu component
     */
//移除子菜单
    public void remove(MenuComponent menuComponent) {
        throw new UnsupportedOperationException();
    }

    /**
     * Gets child.
     *
     * @param index the index
     * @return the child
     */
//获取指定的子菜单
    public MenuComponent getChild(int index) {
        throw new UnsupportedOperationException();
    }

    /**
     * Gets name.
     *
     * @return the name
     */
//获取菜单或者菜单项的名称
    public String getName() {
        return name;
    }

    /**
     * Print.
     */
//打印菜单名称的方法（包含子菜单和字菜单项）
    public abstract void print();
}
